using System;
using System.Runtime.Serialization;

namespace SharpObjects.Cryptography.Symmetric
{
	[Serializable]
	public class SymmetricKey : ICryptoKey, ISymmetricKey
	{
		protected byte [] m_key;
		protected byte [] m_ivector;

		public SymmetricKey()
		{
			m_key = null;
			m_ivector = null;
		}

		//#region ISerializable Members

		public SymmetricKey(SerializationInfo info, StreamingContext context)
		{
			m_key = (byte [])info.GetValue("m_key", typeof(byte []));
			m_ivector = (byte [])info.GetValue("m_ivector", typeof(byte []));
		}

		public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
		{
			info.AddValue("m_key",  m_key);
			info.AddValue("m_ivector",  m_ivector);
		}

		//#endregion

		//#region ISymmetricKey Members

		public byte[] Key
		{
			get
			{
				return m_key;
			}
			set
			{
				m_key = value;
			}
		}

		public byte[] IVector
		{
			get
			{
				return m_ivector;
			}
			set
			{
				m_ivector = value;
			}
		}

		//#endregion
	}
}
